HTML mode has support for editing and coloring of JavaScript. To use this you have to change the default configuration in the settings dialog. The following settings concern JavaScript:
Color JavaScript keywords
If checked, keywords and comments in JavaScript will be colored. The way
the HTML tags are colored is also changed because the old way does not work
well with JavaScript. By default it is not checked, do not color
JavaScript's key words.
Electric left braces
When checked, the left braces, {, will be electric like in C mode. Check
this if you are editing JavaScript. That { is electric means that a
carriage return will automatically be inserted and the next line will be
indented when you type {. By default it is not checked, { is not
electric.
Electric right braces
When checked, the right braces, }, will be electric like in C mode. Check
this if you are editing JavaScript. By default it is not checked, } is not
electric.
Include event handlers in attribute dialog
When checked, the event handlers (onFocus onSelect etc.) will appear in
the attribute dialog. By default it is not checked, no event handlers in
the attribute dialog.
Color of JavaScript keywords
The color of keywords in JavaScript. Applies only if you choose to color
JavaScript keywords. The default is magenta.
Color of JavaScript comments
The color of comments in JavaScript. Applies only if you choose to color
JavaScript keywords. The default is red.
Color of strings
The color of everything between quotes. Applies only if you choose to
color JavaScript keywords. The default is green.
If you do not have an American keyboard, you may have to set two key bindings to be able to use the electric left and right braces. For example, on my Swedish keyboard { is shift-opt-8 and } is shift-opt-9. To use the electric braces I have to bind these keys with
bind '8' <so> electricLeft HTML
bind '9' <so> electricRight HTML
This is put in HTML's preference file, via the menu Config -> Current mode -> Edit prefs. Change your key bindings similarly if needed.